package jevon.philautus.domain;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.validation.constraints.Size;

import org.hibernate.annotations.CollectionOfElements;

/**
 * The persistent class for the sysrole database table.
 * 
 */
@SuppressWarnings("deprecation")
@Entity
public class Role implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	@Column(unique = true, nullable = false)
	private int id;

	@Size(max = 200)
	@Column(length = 200)
	private String remarks;

	@Size(max = 32, min = 6)
	@Column(nullable = false, length = 32)
	private String rolename;

	// bi-directional many-to-one association to Permission
	@CollectionOfElements
	@JoinTable(name = "Permission", joinColumns = @JoinColumn(name = "roleid"))
	@Column(name = "permissions") 
	private Set<String> permissions;

	public Role() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getRemarks() {
		return this.remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getRolename() {
		return this.rolename;
	}

	public void setRolename(String rolename) {
		this.rolename = rolename;
	}

	public void setPermissions(Set<String> permissions) {
		this.permissions = permissions;
	}

	public Set<String> getPermissions() {
		return permissions;
	}

}